
*--------------------------------------------------
* Fishing for good news
* Si Chen and Carl Heese
* University of Hong Kong
* JPE Micro, 2024
*--------------------------------------------------

*--------------------------------------------------
* Program Setup
*--------------------------------------------------
version 15              // set STATA Version number for backward compatibility
set more off            // disable partitioned output
clear all               // start with a clean slate
set linesize 100         // line size limit to make output more readable
macro drop _all         // clear all macros
capture log close       // close existing log files
log using ChenHeese2024.txt, text replace  // Open log file


* ---------------------------------------------------
* SECTION 2.4: THE EXPERIMENTAL PROCEDURE
* ---------------------------------------------------
use ChenHeese_CrossSectional_JPEMicro.dta,clear // open dataset

count
tab treatment
tab sex
tab student
sum age, detail 

sum payment
 

* ---------------------------------------------------
* SECTION 3: FINDINGS	
* ---------------------------------------------------

use ChenHeese_CrossSectional_JPEMicro.dta, clear // open dataset

sum number_info, detail
bysort treatment: sum number_info, detail


* ---------------------------------------------------
* FINDING 1: The First Draws
* ---------------------------------------------------

* Open data file 
use ChenHeese_CrossSectional_JPEMicro.dta, clear

* Diff in diff (Table 3 in Appendix A.1)
** After 1 draw
logit continue_1 i.treatment##i.info_1_white if start_info == 1 // Is the difference in difference significant?

** After 2 draws
logit continue_2 i.treatment##i.more_good_2 // Is the difference in difference significant

* The proportions who continue after the first draws conditioned on the first draws:
bysort info_1_white: tab continue_1 treatment if start_info == 1, co chi2 // chi-2 between treatment if the first info is good or bad
bysort more_good_2: tab continue_2 treatment if number_info >=2, co chi2 // chi-2 between treatment if the first two pieces of info are both good or both bad


log off

*Figure 2a: the first draw
cibar continue_1 if start_info == 1  ///
,over(treatment info_1_white) /// grouped by first draw
barlabel(on) blf(%5.2f) blposition(ne)  blsize(large) /// label the bars with numbers
barcolor(black white) baropts(lcolor(black)) /// specify the bar color and intensity
graphopts( ///
xlabel(,labsize(large)) /// set x axis label
ytitle("proportion", size(large)) /// set y axis label
legend(size(large)) /// set legend size
graphregion(color(white)) bgcolor(white) /// set the background color
xsize(2.5) ysize(2.5) yscale(range(0.45 1.1)) ylabel(.5(.05)1) /// set graph size
text(1.05 1.5 "(p=.27)", size(large)) text(1.05 4.3 "(p=.00)", size(large)) ///
) 
graph export figures/Figure2a.pdf, replace


* Figure 2b: the first two draws
cibar continue_2 if number_info >= 2 & two_good_2 != . & two_good_2 != 2 ///
,over(treatment two_good_2) /// grouped by the first 2 draws
barlabel(on) blf(%5.2f) blposition(ne)  blsize(large) /// label the bars with numbers
barcolor(black white) baropts(lcolor(black)) /// specify the bar color and intensity
graphopts( ///
xlabel(,labsize(large)) /// set x axis label
ytitle("proportion", size(large)) /// set y axis label
legend(size(large)) /// set legend size
graphregion(color(white)) bgcolor(white) /// set the background color
xsize(2.5) ysize(2.5) yscale(range(0.45 1.1)) ylabel(.5(.05)1) /// set graph size
text(1.05 1.5 "(p=.01)" , size(large)) text(1.05 4.3 "(p=.63)" , size(large)) ///
) 
graph export figures/Figure2b.pdf, replace

log on



* ---------------------------------------------------
* FINDING 2: Cox Model
* ---------------------------------------------------
use ChenHeese_EventHistory_JPEMicro, clear // Open the event history format data file 

* Table 4 in Appendix A.2
* Column 1: Cox model estimate with control and strata
stcox i.dominant_news##i.treatment ///
brier_score if start_info == 1 ///
, vce(robust) nohr strata(sex SVO_cat raven_correct)
estat phtest, detail // testing the proportional harzard assumption


* Column 2: Cox model estimate with control but without strata
stcox i.dominant_news##i.treatment ///
brier_score if start_info == 1 ///
, vce(robust) nohr 
estat phtest, detail // testing the proportional harzard assumption


* --------------------------------------------------------------
* FINDING 3, 4 and 5: Receiver Welfare
* --------------------------------------------------------------
use ChenHeese_CrossSectional_JPEMicro.dta, clear // Open data file 

* Finding 3
* Is the aggretaged welfare different between treatments?
tab receiver_pay treatment, chi2

* Finding 4 and 5
* First, we manually construct the counterfactual.
** Use the decision given beliefs from the Tradeoff treatment.
tab Bayesian_rounded decision if treatment == 1
** Use the beliefs in Control.  
bysort state: tab Bayesian_rounded if treatment == 0

* Calculate the fraction of harmless decisions in the counterfactual.
** in Good state
gen count_x_Good_CF = 1*1/3+2*2/6+4*4/20+7*4/36+13*15/35+11*30/37+5*20/27 ///
+13+12+8+5+2+3+1+1 // sum up the number of dictators choosing x at each posterior belief
dis count_x_Good_CF // display the count
count if treatment == 0 & state == 1 // count how many in total are in the Good state
gen frac_G = count_x_Good_CF/r(N) // calculate the fraction of harmless decisions in the counterfactual in the Good state
dis frac_G // display the fraction
** in Bad state
gen count_y_Bad_CF = 6*3/4+4*4/6+2*1+3*4/5+2*4/6+6*7/9+11*0.5+9*16/20 ///
+34*32/36+34*20/35+26*7/37+4*7/27 // sum up the number of dictators choosing x at each posterior belief
dis count_y_Bad_CF 
count if treatment == 0 & state == 0 //
gen frac_B = count_y_Bad_CF/r(N) // calculate the fraction of harmless decisions in the counterfactual in the Bad state
dis frac_B // display the fraction

* sum up the harmless decisions
gen count_harmless_CF = count_x_Good_CF + count_y_Bad_CF
dis count_harmless_CF
count if treatment == 0 // How many decisions are there in total?
gen count_harm_CF = r(N) - count_harmless_CF
gen frac_harmless_CF = count_harmless_CF/r(N) // Overall frac of no harm is 62%
dis frac_harmless_CF // fraction of no harm in the counterfactual
dis 1-frac_harmless_CF // fraction of harm in the counterfactual

* the decision effect: compared to the Control 
inspect receiver_pay if treatment == 0
** Chi-2 test of the decision effect
count if treatment == 0 & receiver_pay == 0 // count harmless in Control
gen count_harmless_CT = r(N)
count if treatment == 0 // count N in Control
gen count_CT = r(N)
gen count_harm_CT = r(N)- count_harmless_CT // count harm in Control
gen chi2_DE = (count_harmless_CF-count_harmless_CT)^2/count_harmless_CT + (count_harm_CF-count_harm_CT)^2/count_harm_CT // Chi2 statistic for the decision effect
dis chi2_DE // Chi square p-value (DF = 1) = .00
** Tradeoff decisions
bysort state: tab decision treatment, co chi2

* the informaiton effect: compared to the Tradeoff
inspect receiver_pay if treatment == 1
** Chi-2 test of the decision effect
count if treatment == 1 & receiver_pay == 0 // count harmless in Tradeoff
gen count_harmless_TO = r(N)
count if treatment == 1 // count N in Tradeoff
gen count_harm_TO = r(N)- count_harmless_TO // count harm in Tradeoff
gen frac_harm_TO = count_harm_TO / r(N) 
gen frac_harmless_TO = count_harmless_TO / r(N)
gen m_harm = frac_harm_TO * count_CT
gen m_harmless = frac_harmless_TO * count_CT
gen chi2_IE = (count_harmless_CF-m_harmless)^2/m_harmless+ (count_harm_CF-m_harm)^2/m_harm // Chi2 statistic for the information effect
dis chi2_IE // Chi square p-value (DF = 1) = .046

*----------------------
* Section 4: Imputed Cutoffs
*----------------------
use ChenHeese_CrossSectional_JPEMicro.dta, clear

tab responsive
tab responsive treatment, co chi2
tab treatment decision if responsive == 0

preserve
keep if responsive == 1 // keeping only the responsive types

* test the treatment effects on the cutoffs
ksmirnov Bayesian_rounded if info_hist == 1, by(treatment) //good news dominant
ksmirnov Bayesian_rounded if info_hist == -1, by(treatment) // bad news dominant

* plot the lower cutoff 
count if decision == 0 // count the N
distplot Bayesian_rounded if info_hist == -1, over(treatment) ///
lp(dash) ///
fcolor(none) lcolor(black black) graphregion(color(white)) bgcolor(white) // styling
graph export figures/Figure3b.pdf, replace


* plot the upper cutoff 
count if decision == 1 // count the N
distplot Bayesian_rounded if info_hist == 1, over(treatment) ///
lp(dash) ///
fcolor(none) lcolor(black black) graphregion(color(white)) bgcolor(white) // styling
graph export figures/Figure3a.pdf, replace


restore

*---------------------------------------
*  Appendix A.3
*---------------------------------------
* Table 5
logit continue_1 i.treatment##i.info_1_white if start_info == 1 & Force ==1  // Is the difference in difference significant?


* Figure 4 the first draw in Force

bysort info_1_white: tab continue_1 treatment if Force == 1, co chi2 // chi-2 between treatment if the first info is good or bad


cibar continue_1 if Force == 1 ///
,over(treatment info_1_white) /// grouped by first draw
barlabel(on) blf(%5.2f) blposition(ne)  blsize(large) /// label the bars with numbers
barcolor(black white) baropts(lcolor(black)) /// specify the bar color and intensity
graphopts( ///
ytitle("proportion", size(large)) /// set y axis label
legend(size(large)) /// set legend size
graphregion(color(white)) bgcolor(white) /// set the background color
xsize(2.5) ysize(2.5) yscale(range(0.45 1.1)) ylabel(.5(.05)1) /// set graph size
xlabel(,labsize(large)) ///
text(1.05 1.5 "(p=.52)", size(large)) text(1.05 4.3 "(p=.01)" ,size(large)) ///
) 
graph export figures/Figure4.pdf, replace


*---------------------------------------
*  Online Appendix C.2: Summrizing Statistics
*---------------------------------------
use ChenHeese_CrossSectional_JPEMicro.dta, clear // open dataset

* Table 6
tab state treatment, co chi2
tab sex treatment, co chi2
tab student treatment, co chi2

bysort treatment: sum age
ttest age, by(treatment)

* Table 7
bysort treatment: sum number_info if start_info == 1, detail
ranksum number_info if start_info == 1, by(treatment) // MWU test

bysort treatment: sum Bayesian_at_decision if start_info == 1, detail
ranksum Bayesian_at_decision if start_info == 1, by(treatment) // MWU test


log off

* Figure 7
twoway(hist number_info if treatment == 1, ///
color(gray) discrete width(1) fraction ) ///
(hist number_info if treatment == 0, ///
fcolor(none) lcolor(black) discrete width(1) fraction), ///
legend(order(1 "Tradeoff" 2 "Control" )) xtitle("") ///
graphregion(color(white)) bgcolor(white)
graph export figures/Figure7.pdf, replace

log on
  

* --------------------------------------------------------------
* Online Appendix C.3 Table 8
* --------------------------------------------------------------

* Robustness check: a logit regression
use ChenHeese_Panel_JPEMicro.dta, clear // open dataset
** column 1: with controls
logit stop i.dominant_news##i.treatment brier_score i.sex i.raven i.SVO_cat i._t ///  
, cluster(unique_id) /// cluster standard error at the individual level
vsquish nolog noomitted noemptycells // display options
* column 2: without controls
logit stop i.dominant_news##i.treatment i._t ///  
, cluster(unique_id) /// cluster standard error at the individual level
vsquish nolog noomitted noemptycells // display options

*---------------------------------------
*  Online Appendix C.4: Self-selection 
*---------------------------------------
use ChenHeese_CrossSectional_JPEMicro, clear

* Force after 1st draw
logit continue_1 i.treatment##i.info_1_white if start_info == 1 & Force == 1 // Is the difference in difference significant in Force?

* The dictator decision of those who opt out
preserve
drop if start_info == 1
bysort treatment: tab decision
restore 

* --------------------------------------------------------------
* Online Appendix C.5: Cognitive Ability and Fishing for Information
* --------------------------------------------------------------

// determine the median
use ChenHeese_CrossSectional_JPEMicro.dta, clear // go back to the original data file
sum raven, detail 
proportion raven


// open data set for the cox model 
use ChenHeese_EventHistory_JPEMicro, clear

preserve
drop if start_info == 0 // focusing on the intensive margin

* high Raven score
stcox i.dominant_news##i.treatment ///
brier_score ///
if raven >= 4 ///
, vce(robust) nohr strata(sex SVO_cat)
estat phtest, detail 

* low Raven score
stcox i.dominant_news##i.treatment ///
brier_score ///
if raven < 4 ///
, vce(robust) nohr strata(sex SVO_cat)
estat phtest, detail 
restore
 
* --------------------------------------------------------------
*  Online Appendix C.6 Posterior Beliefs
* --------------------------------------------------------------
* Open data file 
use ChenHeese_CrossSectional_JPEMicro.dta, clear

preserve
keep if start_info == 1 // only those who acquired some info

* sumarize the Bayesian posterior beliefs
bysort info_hist treatment: sum Bayesian_at_decision

* treatment effects, Mann-Whitney-U test
ranksum Bayesian_at_decision if info_hist == 1, by(treatment) // if good news dominant
ranksum Bayesian_at_decision if info_hist == -1, by(treatment) // if bad news dominant

* compare overall Bayesian beliefs between treatments
ttest Bayesian_at_decision, by(treatment) // student t test for the mean

restore


log off

* Figure 8
// Bayesian posterior beliefs histogram  
twoway(hist Bayesian_at_decision if treatment == 1, ///  
discrete color(gray) width(0.01) fraction ) ///
(hist Bayesian_at_decision if treatment == 0, ///
discrete fcolor(none) lcolor(black) width(0.01)  fraction xline(0.35)), ///
graphregion(color(white)) bgcolor(white) ///
legend(order(1 "Tradeoff" 2 "Control" )) xtitle("Bayesian posterior beliefs")
graph export figures/Figure8.pdf, replace

log on


* --------------------------------------------------------------
*  Online Appendix C.7
* --------------------------------------------------------------
* Table 10
* choosing x%
** pooled
tab decision treatment, co chi2 // overall comparison
bysort state: tab decision treatment, co chi2 // conditioned on state 
* harm%
** pooled
tab receiver_pay treatment, co chi2


* --------------------------------------------------------------
*  Online Appendix C.8
* --------------------------------------------------------------
*---------------------
* Elicited Beliefs
*---------------------

// histogram of the difference between the elicited and the Bayesian belief
log off
 
twoway (histogram belief_diff if treatment == 1, ///
         discrete percent width(0.05) ///
         color(gray)  graphregion(color(white)) bgcolor(white) ) ///
       (histogram belief_diff if treatment == 0, ///
	      discrete percent width(0.05) ///
		  fcolor(none) lcolor(black) graphregion(color(white)) bgcolor(white)), ///
	   legend(order(1 "Tradeoff" 2 "Control" ) ) 
graph export figures/Figure9.pdf, replace

log on
  

// difference between treatments  MWU 
ranksum belief_diff, by(treatment)

// difference in Control and Tradeoff
bysort treatment: sum belief_diff
bysort treatment: signrank Bayesian_rounded = elicited_belief 

*---------------------
* SVO
*---------------------

sum SVO
tab SVO_cat treatment, co chi
ranksum SVO, by(treatment)
bysort treatment: tab decision SVO_cat, co chi2

*---------------------
* Cognitive ability
*---------------------

sum raven
tab raven treatment, co chi2
sum prob_understand
tab prob_understand treatment, co chi2




*--------------------------

log close
